﻿#include "productdlg.h"
#include "ui_productdlg.h"
#include <QFile>
#include <QMessageBox>
#include <QDebug>
#include <QSettings>
#include <QTextCodec>

ProductDlg::ProductDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ProductDlg)
{
    ui->setupUi(this);
    m_dProCreat = new ProCreateDlg(this);
    m_dProCreat->hide();
}

ProductDlg::~ProductDlg()
{
    delete ui;
}

void ProductDlg::on_createBt_clicked()
{
    m_dProCreat->show();
}

void ProductDlg::on_deleteBt_clicked()
{
    if (ui->listWidget->currentRow() < 0){
        return;
    }
    QString iniFilePath = ui->listWidget->currentItem()->text();
    if (QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("以下操作会删除配置文件：") + iniFilePath , tr("Yes"), tr("No")))
    {
        return;
    }
    iniFilePath = "Config/Product/" + iniFilePath + ".ini";
    DirFile(iniFilePath);
    QMessageBox::information(this, tr("Success"), QString::fromLocal8Bit("删除成功！"));
    emit sigProToMain();
}

void ProductDlg::on_confirmBt_clicked()
{
    // 确认
    this->hide();
    if (ui->listWidget->currentRow() < 0){
        return;
    }
    m_nIndex = ui->listWidget->currentRow();
    emit sigProToMain();

}
void ProductDlg::on_listWidget_doubleClicked(const QModelIndex &index)
{
    on_confirmBt_clicked();
}

void ProductDlg::DirFile(QString iniFilePath)
{
    QFile fileTemp(iniFilePath);
    fileTemp.remove();
}

void ProductDlg::on_listWidget_clicked(const QModelIndex &index)
{
    QString file_name = index.data().toString();
    // 读取 ini 获取 算法 检测选择

    QString iniFilePath =  file_name +".ini";
    RdProductIni(iniFilePath);
    ui->groupBox->setEnabled(true);
}


void ProductDlg::RdProductIni(QString iniFilePath)
{
    QString Path = "Config/Product/" + iniFilePath;
    QSettings iniRead(Path, QSettings::IniFormat);
    iniRead.setIniCodec(QTextCodec::codecForName("UTF_8"));


    // 获取 设置产品 规格类型
    QString strName = iniRead.value("Type/name").toString();
    int nType = iniRead.value("Type/type").toInt();
    QString strSize = iniRead.value("Type/size").toString();

    // 设置 信息
    ui->lineEdit_name->setText(strName);
    ui->comboBox_type->setCurrentIndex(nType);
    ui->lineEdit_size->setText(strSize);


    int* nIndex = &m_swAlg.m_ccd1.nCCD;

    // 获取检测参数
    QString sInfo;

    for (int a = 0; a < 40; a++)
    {
        sInfo = QString("AlgSwitch/parame%1").arg(a);
        *nIndex = iniRead.value(sInfo).toInt();
        nIndex++;
    }

    updateSwAlg();
}



void ProductDlg::updateSwAlg()
{
    SW_AlgPart* m_pAlgPart = &m_swAlg.m_ccd1;
    QGroupBox* qGBox;
    QRadioButton* qRBt;
    for(int i = 0; i < 8;i++){
        qGBox = this->findChild<QGroupBox*>(QString("CCD_GBox%1").arg(i+1));
        if(m_pAlgPart->nCCD){
            qGBox->setChecked(true);
            qGBox = this->findChild<QGroupBox*>(QString("CCD_GBox%1_1").arg(i+1));
            if(m_pAlgPart->nAlgA){
                qGBox->setChecked(true);
                switch (m_pAlgPart->nDefect) {
                case 1:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_1_1").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 2:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_1_2").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 3:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_1_3").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 4:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_1_4").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                default:
                    break;
                }
            }else{
                qGBox->setChecked(false);
            }
            qGBox = this->findChild<QGroupBox*>(QString("CCD_GBox%1_2").arg(i+1));
            if(m_pAlgPart->nAlgB){
                qGBox->setChecked(true);
                switch (m_pAlgPart->nRect) {
                case 1:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_1").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 2:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_2").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 3:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_3").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 4:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_4").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 5:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_5").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 6:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_6").arg(i+1));
                    qRBt->setChecked(true);
                    break; 
                case 7:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_7").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                case 8:
                    qRBt = this->findChild<QRadioButton*>(QString("CCD_RBt%1_2_8").arg(i+1));
                    qRBt->setChecked(true);
                    break;
                default:
                    break;
                }
            }else{
                qGBox->setChecked(false);
            }
        }else{
            qGBox->setChecked(false);
        }
        m_pAlgPart++;
    }
}

void ProductDlg::updateListInfo()
{
    ui->listWidget->clear();
    ui->listWidget->addItems(file_names);
}




void ProductDlg::on_changeBt_clicked()
{
    // 修改检测选项
    if (ui->listWidget->currentRow() < 0){
        return;
    }
    QString iniFilePath = ui->listWidget->currentItem()->text();
    if (QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("以下操作会修改配置文件：") + iniFilePath , tr("Yes"), tr("No")))
    {
        return;
    }
    iniFilePath = iniFilePath + ".ini";
    WdProductIni(iniFilePath);

}
void ProductDlg::WdProductIni(QString iniFilePath)
{
    QString Path = "Config/Product/" + iniFilePath;
    QSettings iniWrite(Path, QSettings::IniFormat);
    iniWrite.setIniCodec(QTextCodec::codecForName("UTF_8"));

    // 设置 信息

    iniWrite.setValue("Type/name", ui->lineEdit_name->text());
    iniWrite.setValue("Type/type", ui->comboBox_type->currentIndex());
    iniWrite.setValue("Type/size", ui->lineEdit_size->text());
    int* nIndex = &m_swAlg.m_ccd1.nCCD;

    // 获取检测参数
    for (int i = 0; i < 40; i++){
        iniWrite.setValue(QString("AlgSwitch/parame%1").arg(i), *nIndex);
        nIndex++;
    }
    QMessageBox::information(this, tr("Success"), QString::fromLocal8Bit("写入成功！"));
    emit sigProToMain();
}



/*-------------------------------CCD1-----------------------------------------*/
void ProductDlg::on_CCD_GBox1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd1.nCCD = 1;
    }else{
        m_swAlg.m_ccd1.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox1_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd1.nAlgA = 1;
    }else{
        m_swAlg.m_ccd1.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox1_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd1.nAlgB = 1;
    }else{
        m_swAlg.m_ccd1.nAlgB = 0;
    }
}
// CCD1 缺陷
void ProductDlg::on_CCD_RBt1_1_1_clicked()
{
    m_swAlg.m_ccd1.nDefect = 1;
}
void ProductDlg::on_CCD_RBt1_1_2_clicked()
{
    m_swAlg.m_ccd1.nDefect = 2;
}

void ProductDlg::on_CCD_RBt1_1_3_clicked()
{
    m_swAlg.m_ccd1.nDefect = 3;
}

void ProductDlg::on_CCD_RBt1_1_4_clicked()
{
    m_swAlg.m_ccd1.nDefect = 4;
}

// CCD1 尺寸
void ProductDlg::on_CCD_RBt1_2_1_clicked()
{
    m_swAlg.m_ccd1.nRect = 1;
}

void ProductDlg::on_CCD_RBt1_2_2_clicked()
{
    m_swAlg.m_ccd1.nRect = 2;
}
void ProductDlg::on_CCD_RBt1_2_3_clicked()
{
    m_swAlg.m_ccd1.nRect = 3;
}
void ProductDlg::on_CCD_RBt1_2_4_clicked()
{
    m_swAlg.m_ccd1.nRect = 4;
}

void ProductDlg::on_CCD_RBt1_2_5_clicked()
{
    m_swAlg.m_ccd1.nRect = 5;
}


void ProductDlg::on_CCD_RBt1_2_6_clicked()
{
    m_swAlg.m_ccd1.nRect = 6;
}

void ProductDlg::on_CCD_RBt1_2_7_clicked()
{
    m_swAlg.m_ccd1.nRect = 7;
}

void ProductDlg::on_CCD_RBt1_2_8_clicked()
{
     m_swAlg.m_ccd1.nRect = 8;
}

/*-------------------------------CCD2-----------------------------------------*/
void ProductDlg::on_CCD_GBox2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd2.nCCD = 1;
    }else{
        m_swAlg.m_ccd2.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox2_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd2.nAlgA = 1;
    }else{
        m_swAlg.m_ccd2.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox2_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd2.nAlgB = 1;
    }else{
        m_swAlg.m_ccd2.nAlgB = 0;
    }
}

//CCD2 缺陷

void ProductDlg::on_CCD_RBt2_1_1_clicked()
{
    m_swAlg.m_ccd2.nDefect = 1;
}

void ProductDlg::on_CCD_RBt2_1_2_clicked()
{
    m_swAlg.m_ccd2.nDefect = 2;
}

void ProductDlg::on_CCD_RBt2_1_3_clicked()
{
    m_swAlg.m_ccd2.nDefect = 3;
}

void ProductDlg::on_CCD_RBt2_1_4_clicked()
{
    m_swAlg.m_ccd2.nDefect = 4;
}


//CCD2 尺寸
void ProductDlg::on_CCD_RBt2_2_1_clicked()
{
    m_swAlg.m_ccd2.nRect = 1;
}

void ProductDlg::on_CCD_RBt2_2_2_clicked()
{
    m_swAlg.m_ccd2.nRect = 2;
}
void ProductDlg::on_CCD_RBt2_2_3_clicked()
{
    m_swAlg.m_ccd2.nRect = 3;
}
void ProductDlg::on_CCD_RBt2_2_4_clicked()
{
    m_swAlg.m_ccd2.nRect = 4;
}
void ProductDlg::on_CCD_RBt2_2_5_clicked()
{
    m_swAlg.m_ccd2.nRect = 5;
}

void ProductDlg::on_CCD_RBt2_2_6_clicked()
{
    m_swAlg.m_ccd2.nRect = 6;
}

void ProductDlg::on_CCD_RBt2_2_7_clicked()
{
    m_swAlg.m_ccd2.nRect = 7;
}

void ProductDlg::on_CCD_RBt2_2_8_clicked()
{
     m_swAlg.m_ccd2.nRect = 8;
}
/*-------------------------------CCD3-----------------------------------------*/
void ProductDlg::on_CCD_GBox3_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd3.nCCD = 1;
    }else{
        m_swAlg.m_ccd3.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox3_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd3.nAlgA = 1;
    }else{
        m_swAlg.m_ccd3.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox3_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd3.nAlgB = 1;
    }else{
        m_swAlg.m_ccd3.nAlgB = 0;
    }
}

//CCD3 缺陷
void ProductDlg::on_CCD_RBt3_1_1_clicked()
{
    m_swAlg.m_ccd3.nDefect = 1;
}

void ProductDlg::on_CCD_RBt3_1_2_clicked()
{
    m_swAlg.m_ccd3.nDefect = 2;
}

void ProductDlg::on_CCD_RBt3_1_3_clicked()
{
    m_swAlg.m_ccd3.nDefect = 3;
}

void ProductDlg::on_CCD_RBt3_1_4_clicked()
{
    m_swAlg.m_ccd3.nDefect = 4;
}

//CCD3 尺寸
void ProductDlg::on_CCD_RBt3_2_1_clicked()
{
    m_swAlg.m_ccd3.nRect = 1;
}

void ProductDlg::on_CCD_RBt3_2_2_clicked()
{
    m_swAlg.m_ccd3.nRect = 2;
}

void ProductDlg::on_CCD_RBt3_2_3_clicked()
{
    m_swAlg.m_ccd3.nRect = 3;
}
void ProductDlg::on_CCD_RBt3_2_4_clicked()
{
    m_swAlg.m_ccd3.nRect = 4;
}
void ProductDlg::on_CCD_RBt3_2_5_clicked()
{
    m_swAlg.m_ccd3.nRect = 5;
}

void ProductDlg::on_CCD_RBt3_2_6_clicked()
{
    m_swAlg.m_ccd3.nRect = 6;
}

void ProductDlg::on_CCD_RBt3_2_7_clicked()
{
    m_swAlg.m_ccd3.nRect = 7;
}


void ProductDlg::on_CCD_RBt3_2_8_clicked()
{
     m_swAlg.m_ccd3.nRect = 8;
}

/*-------------------------------CCD4-----------------------------------------*/
void ProductDlg::on_CCD_GBox4_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd4.nCCD = 1;
    }else{
        m_swAlg.m_ccd4.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox4_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd4.nAlgA = 1;
    }else{
        m_swAlg.m_ccd4.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox4_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd4.nAlgB = 1;
    }else{
        m_swAlg.m_ccd4.nAlgB = 0;
    }
}


//CCD4 缺陷
void ProductDlg::on_CCD_RBt4_1_1_clicked()
{
    m_swAlg.m_ccd4.nDefect = 1;
}

void ProductDlg::on_CCD_RBt4_1_2_clicked()
{
    m_swAlg.m_ccd4.nDefect = 2;
}

void ProductDlg::on_CCD_RBt4_1_3_clicked()
{
    m_swAlg.m_ccd4.nDefect = 3;
}

void ProductDlg::on_CCD_RBt4_1_4_clicked()
{
    m_swAlg.m_ccd4.nDefect = 4;
}

//CCD4 尺寸
void ProductDlg::on_CCD_RBt4_2_1_clicked()
{
    m_swAlg.m_ccd4.nRect = 1;
}

void ProductDlg::on_CCD_RBt4_2_2_clicked()
{
    m_swAlg.m_ccd4.nRect = 2;
}

void ProductDlg::on_CCD_RBt4_2_3_clicked()
{
    m_swAlg.m_ccd4.nRect = 3;
}
void ProductDlg::on_CCD_RBt4_2_4_clicked()
{
    m_swAlg.m_ccd4.nRect = 4;
}

void ProductDlg::on_CCD_RBt4_2_5_clicked()
{
    m_swAlg.m_ccd4.nRect = 5;
}

void ProductDlg::on_CCD_RBt4_2_6_clicked()
{
    m_swAlg.m_ccd4.nRect = 6;
}

void ProductDlg::on_CCD_RBt4_2_7_clicked()
{
    m_swAlg.m_ccd4.nRect = 7;
}


void ProductDlg::on_CCD_RBt4_2_8_clicked()
{
     m_swAlg.m_ccd4.nRect = 8;
}



/*-------------------------------CCD5-----------------------------------------*/
void ProductDlg::on_CCD_GBox5_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd5.nCCD = 1;
    }else{
        m_swAlg.m_ccd5.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox5_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd5.nAlgA = 1;
    }else{
        m_swAlg.m_ccd5.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox5_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd5.nAlgB = 1;
    }else{
        m_swAlg.m_ccd5.nAlgB = 0;
    }
}


//CCD5 缺陷
void ProductDlg::on_CCD_RBt5_1_1_clicked()
{
    m_swAlg.m_ccd5.nDefect = 1;
}

void ProductDlg::on_CCD_RBt5_1_2_clicked()
{
    m_swAlg.m_ccd5.nDefect = 2;
}

void ProductDlg::on_CCD_RBt5_1_3_clicked()
{
    m_swAlg.m_ccd5.nDefect = 3;
}

void ProductDlg::on_CCD_RBt5_1_4_clicked()
{
    m_swAlg.m_ccd5.nDefect = 4;
}

//CCD5 尺寸
void ProductDlg::on_CCD_RBt5_2_1_clicked()
{
    m_swAlg.m_ccd5.nRect = 1;
}

void ProductDlg::on_CCD_RBt5_2_2_clicked()
{
    m_swAlg.m_ccd5.nRect = 2;
}

void ProductDlg::on_CCD_RBt5_2_3_clicked()
{
    m_swAlg.m_ccd5.nRect = 3;
}
void ProductDlg::on_CCD_RBt5_2_4_clicked()
{
    m_swAlg.m_ccd5.nRect = 4;
}

void ProductDlg::on_CCD_RBt5_2_5_clicked()
{
    m_swAlg.m_ccd5.nRect = 5;
}

void ProductDlg::on_CCD_RBt5_2_6_clicked()
{
    m_swAlg.m_ccd5.nRect = 6;
}

void ProductDlg::on_CCD_RBt5_2_7_clicked()
{
    m_swAlg.m_ccd5.nRect = 7;
}

void ProductDlg::on_CCD_RBt5_2_8_clicked()
{
     m_swAlg.m_ccd5.nRect = 8;
}

/*-------------------------------CCD6-----------------------------------------*/
void ProductDlg::on_CCD_GBox6_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd6.nCCD = 1;
    }else{
        m_swAlg.m_ccd6.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox6_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd6.nAlgA = 1;
    }else{
        m_swAlg.m_ccd6.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox6_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd6.nAlgB = 1;
    }else{
        m_swAlg.m_ccd6.nAlgB = 0;
    }
}


//CCD6 缺陷
void ProductDlg::on_CCD_RBt6_1_1_clicked()
{
    m_swAlg.m_ccd6.nDefect = 1;
}

void ProductDlg::on_CCD_RBt6_1_2_clicked()
{
    m_swAlg.m_ccd6.nDefect = 2;
}

void ProductDlg::on_CCD_RBt6_1_3_clicked()
{
    m_swAlg.m_ccd6.nDefect = 3;
}

void ProductDlg::on_CCD_RBt6_1_4_clicked()
{
    m_swAlg.m_ccd6.nDefect = 4;
}

//CCD6 尺寸
void ProductDlg::on_CCD_RBt6_2_1_clicked()
{
    m_swAlg.m_ccd6.nRect = 1;
}

void ProductDlg::on_CCD_RBt6_2_2_clicked()
{
    m_swAlg.m_ccd6.nRect = 2;
}

void ProductDlg::on_CCD_RBt6_2_3_clicked()
{
    m_swAlg.m_ccd6.nRect = 3;
}
void ProductDlg::on_CCD_RBt6_2_4_clicked()
{
    m_swAlg.m_ccd6.nRect = 4;
}

void ProductDlg::on_CCD_RBt6_2_5_clicked()
{
    m_swAlg.m_ccd6.nRect = 5;
}

void ProductDlg::on_CCD_RBt6_2_6_clicked()
{
    m_swAlg.m_ccd6.nRect = 6;
}

void ProductDlg::on_CCD_RBt6_2_7_clicked()
{
    m_swAlg.m_ccd6.nRect = 7;
}

void ProductDlg::on_CCD_RBt6_2_8_clicked()
{
     m_swAlg.m_ccd6.nRect = 8;
}

/*-------------------------------CCD7-----------------------------------------*/

void ProductDlg::on_CCD_GBox7_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd7.nCCD = 1;
    }else{
        m_swAlg.m_ccd7.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox7_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd7.nAlgA = 1;
    }else{
        m_swAlg.m_ccd7.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox7_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd7.nAlgB = 1;
    }else{
        m_swAlg.m_ccd7.nAlgB = 0;
    }
}


//CCD7 缺陷
void ProductDlg::on_CCD_RBt7_1_1_clicked()
{
    m_swAlg.m_ccd7.nDefect = 1;
}

void ProductDlg::on_CCD_RBt7_1_2_clicked()
{
    m_swAlg.m_ccd7.nDefect = 2;
}

void ProductDlg::on_CCD_RBt7_1_3_clicked()
{
    m_swAlg.m_ccd7.nDefect = 3;
}

void ProductDlg::on_CCD_RBt7_1_4_clicked()
{
    m_swAlg.m_ccd7.nDefect = 4;
}


//CCD7 尺寸
void ProductDlg::on_CCD_RBt7_2_1_clicked()
{
    m_swAlg.m_ccd7.nRect = 1;
}

void ProductDlg::on_CCD_RBt7_2_2_clicked()
{
    m_swAlg.m_ccd7.nRect = 2;
}

void ProductDlg::on_CCD_RBt7_2_3_clicked()
{
    m_swAlg.m_ccd7.nRect = 3;
}

void ProductDlg::on_CCD_RBt7_2_4_clicked()
{
    m_swAlg.m_ccd7.nRect = 4;
}

void ProductDlg::on_CCD_RBt7_2_5_clicked()
{
    m_swAlg.m_ccd7.nRect = 5;
}

void ProductDlg::on_CCD_RBt7_2_6_clicked()
{
    m_swAlg.m_ccd7.nRect = 6;
}

void ProductDlg::on_CCD_RBt7_2_7_clicked()
{
    m_swAlg.m_ccd7.nRect = 7;
}

void ProductDlg::on_CCD_RBt7_2_8_clicked()
{
    m_swAlg.m_ccd7.nRect = 8;
}

/*-------------------------------CCD8-----------------------------------------*/

void ProductDlg::on_CCD_GBox8_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd8.nCCD = 1;
    }else{
        m_swAlg.m_ccd8.nCCD = 0;
    }
}

void ProductDlg::on_CCD_GBox8_1_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd8.nAlgA = 1;
    }else{
        m_swAlg.m_ccd8.nAlgA = 0;
    }
}

void ProductDlg::on_CCD_GBox8_2_clicked(bool checked)
{
    if(checked){
        m_swAlg.m_ccd8.nAlgB = 1;
    }else{
        m_swAlg.m_ccd8.nAlgB = 0;
    }
}

//CCD8 缺陷
void ProductDlg::on_CCD_RBt8_1_1_clicked()
{
    m_swAlg.m_ccd8.nDefect = 1;
}

void ProductDlg::on_CCD_RBt8_1_2_clicked()
{
    m_swAlg.m_ccd8.nDefect = 2;
}

void ProductDlg::on_CCD_RBt8_1_3_clicked()
{
    m_swAlg.m_ccd8.nDefect = 3;
}

void ProductDlg::on_CCD_RBt8_1_4_clicked()
{
    m_swAlg.m_ccd8.nDefect = 4;
}

//CCD8 尺寸
void ProductDlg::on_CCD_RBt8_2_1_clicked()
{
    m_swAlg.m_ccd8.nRect = 1;
}

void ProductDlg::on_CCD_RBt8_2_2_clicked()
{
    m_swAlg.m_ccd8.nRect = 2;
}

void ProductDlg::on_CCD_RBt8_2_3_clicked()
{
    m_swAlg.m_ccd8.nRect = 3;
}

void ProductDlg::on_CCD_RBt8_2_4_clicked()
{
    m_swAlg.m_ccd8.nRect = 4;
}

void ProductDlg::on_CCD_RBt8_2_5_clicked()
{
    m_swAlg.m_ccd8.nRect = 5;
}

void ProductDlg::on_CCD_RBt8_2_6_clicked()
{
    m_swAlg.m_ccd8.nRect = 6;
}


void ProductDlg::on_CCD_RBt8_2_7_clicked()
{
    m_swAlg.m_ccd8.nRect = 7;
}

void ProductDlg::on_CCD_RBt8_2_8_clicked()
{
    m_swAlg.m_ccd8.nRect = 8;
}
